package com.leng.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.leng.entity.AirQualityIndex;
import com.leng.mapper.AirQualityIndexMapper;
import com.leng.service.AirQualityIndexService;

import java.util.List;

/**
 * @Author: 冷俊杰
 * @Description: TODO
 * @DateTime: 2022/8/1 16:55
 **/
@Service
public class AirQualityIndexServiceImpl implements AirQualityIndexService {

    @Resource
    private AirQualityIndexMapper airQualityIndexMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return airQualityIndexMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(AirQualityIndex record) {
        return airQualityIndexMapper.insert(record);
    }

    @Override
    public AirQualityIndex selectByPrimaryKey(Integer id) {
        return airQualityIndexMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(AirQualityIndex record) {
        return airQualityIndexMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(AirQualityIndex record) {
        return airQualityIndexMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo<AirQualityIndex> pageInfo(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<AirQualityIndex> accessControlDevices = airQualityIndexMapper.listAQ();
        PageInfo<AirQualityIndex> pageInfo = new PageInfo<AirQualityIndex>(accessControlDevices);
        return pageInfo;
    }

    @Override
    public PageInfo<AirQualityIndex> pageInfoByAQ(int pageNum, int pageSize, AirQualityIndex record) {
        PageHelper.startPage(pageNum, pageSize);
        List<AirQualityIndex> airQualityIndices = airQualityIndexMapper.listAQBydistricid(record);
        PageInfo<AirQualityIndex> pageInfo = new PageInfo<AirQualityIndex>(airQualityIndices);
        return pageInfo;
    }


}
